package co.sanduche.teach;

import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import co.sanduche.services.EPClient.DevPhase;
import co.sanduche.teach.gallery.GalleryActivity;
import co.sanduche.views.BasicSplashScreenActivity;

import com.newrelic.agent.android.NewRelic;

public class SplashScreenActivity extends BasicSplashScreenActivity {

	public void finishCreate() {
		NewRelic.withApplicationToken(
				"AA7f966d13b0c7192114101666e1b61bd0d8f13d66").start(
				this.getApplication());
	}

	@Override
	public Class<? extends Activity> getNextActivityClass() {
		return GalleryActivity.class;
	}

	@Override
	public Class<? extends Activity> getLoginActivityClass() {
		return LoginActivity.class;
	}

	@Override
	public int getSplashImageId() {
		return R.drawable.splash;
	}

	@Override
	public int getSplashBackgroundColorId() {
		return R.color.kiido_splashBackground;
	}

	@Override
	public int getSplashTimeout() {
		return 2000;
	}

	@Override
	public String getVersion() {
		PackageInfo info;
		try {
			info = getPackageManager().getPackageInfo(getPackageName(), 0);
			String version = info.versionName;
			return version
					+ (TeachApp.PHASE == DevPhase.Production ? "" : " - "
							+ TeachApp.PHASE.name());
		} catch (NameNotFoundException e) {
			e.printStackTrace();
			throw new RuntimeException(
					"No se encuentra el nombre del paquete (no deberia pasar)");
		}
	}

}
